<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      var n = +prompt("请输入整数");
      var save = n;
      // 判断整数
      if (n % 1 === 0) {
        // 存储质因数的数组
        var saveNum = [];
        var originalNum = 2;
        while (n >= 2) {
          if (n % originalNum == 0) {
            saveNum.push(originalNum);
            //除以质因数
            n = n / originalNum;
          } else {
            // 除不了就加到它除的了为止
            originalNum++;
          }
        }
      } else {
        alert("请输入整数！！！！！！");
      }
      alert(`${save}=${saveNum.join("x")}`);
    </script>
  </body>
</html>
